package cn.wit.front.controller;

import cn.wit.front.condition.SearchCurriculumCondition;
import cn.wit.front.service.CurriculumService;
import cn.wit.utils.pojo.Curriculum;
import cn.wit.utils.response.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/tech/curriculum")
@CrossOrigin
@Api(tags = "课程管理")
public class CurriculumController {
    private Logger logger = LoggerFactory.getLogger(CurriculumController.class);

    @Autowired
    private CurriculumService curriculumService;


    @GetMapping("/searchCurriculum/{num}/{size}")
    @ApiOperation(value = "条件搜索课程")
    public Result searchCurriculum(@PathVariable("num") int num,
                                   @PathVariable("size") int size, SearchCurriculumCondition condition) {
        IPage<Curriculum> page = new Page<>(num, size);
        return this.curriculumService.searchPage(page, condition);
    }


}

